<?php
/**
 * Created by PhpStorm.
 * User: 戎大富
 * Date: 2020/3/9
 * Time: 9:51
 */
namespace app\api\controller;
use think\Db;
class World extends Base {
    /**
     * 异地登录验证
     * @return string
     */
    public function __construct()
    {
        $this->user_id = input('user_id');
        $this->page = input('page') ? input('page') : 1;
        $this->create_time = date('Y-m-d H:i:s');
//        $time = input('time');
//        $value = input('value');
//        $reqKey = input('reqKey');
//        $auth = $this->checkAll($this->user_id,$time,$value,$reqKey);
//        if($auth == 112){
//            echo json_encode(['status'=>301,'msg'=>$this->otherLogin]);
//            exit;
//        }elseif($auth == 110){
//            echo json_encode(['status' => 302, 'msg' => $this->frost]);
//            exit;
//        }elseif($auth == 2111){
//            echo json_encode(['status' => 303, 'msg' => $this->del]);
//            exit;
//        }
    }


    //
    public function ranking(){
        extract(input());
        $page = input('param.page')?input('param.page'):1;
        $num = 10;
        $limit = ($page-1)*$num;
        $type = input('param.type');//1势力版   2魅力榜
        if($type==1){
            $where['user_gender'] = 1;
            $list = Db::table('up_u_user')->where($where)
                ->field('user_id,user_username,user_image,user_consume')
                ->limit($limit,$num)
                ->order('user_consume desc')
                ->select();
        }elseif ($type==2){
            $where['user_gender'] = 2;
            $list = Db::table('up_u_user')->where($where)
                ->field('user_id,user_username,user_image,user_integral')
                ->limit($limit,$num)
                ->order('user_integral desc')
                ->select();
        }
        return  json(array('status'=>200,'msg'=>$list));
    }
}